home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 9 / Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO / 018a / uncomp12.zip / UNCOMP.C < prev    next >
C/C++ Source or Header  |  1993-05-06  |  3KB  |  101 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <conio.h>
  4. #include <string.h>
  5. #include <ctype.h>
  6.  
  7. void warning(void);
  8. void ooops(void);
  9. void goodbye(void);
  10. void unpak(char ext[3],char flname[255]);
  11.  
  12. void main(void)
  13. {
  14.   char inname[255],e[2];
  15.   int sl;
  16.  
  17.   clrscr();
  18.  
  19.   printf("The Uncompresser v1.2, by me, the one, the only, the greatest,\n");
  20.   printf("the fabulous, the stupendous, SNAPPLE DRINKER!!!\n\n");
  21.   printf("If you have any trouble, call CompuData, 609-232-1245, and go\n");
  22.   printf("into chat mode, chances are I'm there.\n\n");
  23.  
  24.   warning();
  25.  
  26.   printf("What is the filename that you wish to unzip? Include the\n");
  27.   printf("extension and path, \"EX: \\GAMES\\MYGAME.ZIP\", .ZIP is the\n");
  28.   printf("extension and \\GAMES is the path. Press CTRL-C to exit\n\n");
  29.  
  30.   ooops();
  31.  
  32.   scanf("%s",inname);
  33.   sl=strlen(inname);
  34.   e[0]=toupper(inname[sl-3]);
  35.   e[1]=toupper(inname[sl-2]);
  36.   e[2]=toupper(inname[sl-1]);
  37.  
  38.   if (!strcmp(e,"ZIP") || !strcmp(e,"ARJ") || !strcmp(e,"LZH"))
  39.     unpak(e,inname);
  40.   printf("\n\nSorry, it must be either .ZIP, .ARJ, or .LZH\n\n");
  41.   return;
  42. }
  43.  
  44. void unpak(char ext[3],char flname[255])
  45. {
  46.   char where[255],doscommand[255];
  47.  
  48.   printf("\n\n");
  49.   printf("Where do you want your file to go? EX: \"\\GAMES\", if you are\n");
  50.   printf("a beginner, make sure you put the \\ first.\n\n");
  51.   scanf("%s",where);
  52.   strcpy(doscommand,"MD");
  53.   strcat(doscommand,where);
  54.   system(doscommand);
  55.   strcpy(doscommand,"CD");
  56.   strcat(doscommand,where);
  57.   system(doscommand);
  58.  
  59.   if (!strcmp(ext,"ZIP")) {
  60.     strcpy(doscommand,"PKUNZIP ");
  61.     strcat(doscommand,flname);
  62.     system(doscommand);
  63.     goodbye();
  64.   }
  65.  
  66.   if (!strcmp(ext,"ARJ")) {
  67.     strcpy(doscommand,"ARJ X ");
  68.     strcat(doscommand,flname);
  69.     system(doscommand);
  70.     goodbye();
  71.   }
  72.  
  73.   strcpy(doscommand,"LHA X ");
  74.   strcat(doscommand,flname);
  75.   system(doscommand);
  76.   goodbye();
  77. }
  78.  
  79. void goodbye(void)
  80. {
  81.   printf("\n\n\nWell, if you didn't get any errors, then you are set to\n");
  82.   printf("go. Make sure you read or print the instructions for the file\n");
  83.   printf("that you downloaded before using it.\n\n");
  84.   exit(0);
  85. }
  86.  
  87. void warning(void)
  88. {
  89.   printf("Before you procede, copy the 3 files, LHA.EXE, ARJ.EXE, and\n");
  90.   printf("PKUNZIP.EXE to you DOS directory, EX: \"COPY LHA.EXE \\DOS\".\n");
  91.   printf("Also, for beginners, put this in the DOS directory OR the same\n");
  92.   printf("as the file you are trying to un-compress.\n\n\n");
  93.   return;
  94. }
  95.  
  96. void ooops(void)
  97. {
  98.   printf("This time I -KNOW- I got all the bugs out :)\n\n");
  99.   return;
  100. }
  101.